/*
 * @Author: @xiaoye-lan 2369037721@qq.com
 * @Date: 2022-11-07 00:38:23
 * @LastEditors: @xiaoye-lan 2369037721@qq.com
 * @LastEditTime: 2022-11-10 14:59:56
 * @FilePath: \cq-work\vue-cq\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import AboutUs from '@/views/AboutUs.vue'
import CaseTrade from '@/views/CaseTrade.vue'
import SuppLiers from '@/views/SuppLiers.vue'
import News from '@/views/News.vue'
import ErrorPage from '@/views/ErrorPage'
import Layout from '@/views/Layout'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    // 用layout作为全局组件
    component: Layout,
    children: [
      { path: '/', redirect: '/index' },
      { path: '/index', name: 'home', component: HomeView },
      { path: '/about', name: 'about', component: AboutUs },
      { path: '/case', name: 'case', component: CaseTrade },
      { path: '/join', name: 'join', component: SuppLiers },
      { path: '/news', name: 'news', component: News },
      { path: '/home', name: 'home', component: HomeView }
    ]
  },
  {
    path: '*',
    component: ErrorPage
  }
]
const router = new VueRouter({
  routes
})
export default router
